/-boot
/-docs
/-editor
/-files
/-files-old
/-imports
/-layout
/-shell
/-storage ...
/-storage/attached ...
/-storage/attached/api
/-storage/attached/dom ...
DetectStorage.ts
LoadStorage.ts
StorageAccess.ts
StorageDetect.ts
UpdateStorage.ts
/-storage/attached/indexedDB
/-storage/attached/localStorage
/-storage/attached/webSQL
/-tests
/-tests/files
/-tests/storage
TestCase.html
TestCase.ts
TestPage.css
TestPage.html
TestPage.ts
_sampleTests.ts
teapo-tests.html
teapo-tests.ts
/-typings
Dom.ts
TypeScriptService.ts
functions.ts
ko.ts
nteapo.html
persistence.api.ts
persistence.ts
shell.ts
teapo.html
teapo.ts
try.html
try.js
x
    static createElement(parentElement: HTMLElement, fullPath: string, _document: { createElement(tag: string): HTMLElement; }): HTMLElement {
 
27
            element = StorageAccess.createElement(this._parentElement, fullPath, this._document);
28
            this._byName[fullPath] = element;
29
          }
30
          for (var p in updateProperties) if (updateProperties.hasOwnProperty(p)) {
31
            var v = updateProperties[p];
32
            var attrName = 'tp-' + encodeForAttributeName(p);
33
            if (v === null)
34
              element.removeAttribute(attrName);
35
            else
36
              element.setAttribute(attrName, v);
37
          }
38
        }
39
      }
40
​
41
      this._parentElement.setAttribute('data-teapo-file-count', <any>this._parentElement.children.length);
42
      this._parentElement.setAttribute('data-edited-utc', <any>timestamp);
43
​
44
      callback(null);
45
    }
46
​
47
    read(
48
      fullPaths: string[],
49
      callback: (error: Error, byFullPath: PropertiesByFullPath) => void): void {
50
      var byFullPath: PropertiesByFullPath = {};
51
      if (fullPaths === null || typeof fullPaths === 'undefined') {
52
        for (var fullPath in this._byName) if (this._byName.hasOwnProperty(fullPath)) {
53
          var element = this._getExistingElement(fullPaths[i]);
54
          var propBag = this._readFileProperties(element);
55
          byFullPath[fullPaths[i]] = propBag;
56
        }
57
      }
58
      else {
59
        for (var i = 0; i < fullPaths.length; i++) {
60
          var element = this._getExistingElement(fullPaths[i]);
61
          var propBag = element ? this._readFileProperties(element) : null;
62
          byFullPath[fullPaths[i]] = propBag;
63
        }
64
      }
65
      callback(null, byFullPath);
66
    }
67
​
68
    private _readFileProperties(element: HTMLElement) {      
69
      var properties: { [property: string]: string; } = {};
70
      for (var i = 0; i < element.attributes.length; i++) {
71
        var attr = element.attributes.item(i);
72
        if (!startsWith(attr.name.toLowerCase(), 'tp-')) continue;
73
        var propertyName = decodeFromAttributeName(attr.name.slice(3 /* 'tp-'.length */));
74
        properties[propertyName] = attr.value;
75
      }
76
      return properties;
77
    }
78
​
60:74